package com.zmt.content.feignClient;

import com.zmt.content.config.MultipartSupportConfig;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.http.MediaType;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

@FeignClient(value = "media-api",configuration = {MultipartSupportConfig.class},fallbackFactory = MediaServiceFallBackFactory.class)//指定发起的请求发向media-api，加载配置类
public interface MediaServiceClient {

    /**
     * @param file
     * @param objectName
     * @return
     */
    @RequestMapping(value = "/media/upload/coursefile",consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
    String upload(@RequestPart("filedata") MultipartFile file,
                                  @RequestParam(value = "objectName",required = false) String objectName);
}